<!DOCTYPE HTML>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<body>
    <script type="text/javascript" src="http://ueditor.baidu.com/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="http://ueditor.baidu.com/ueditor/ueditor.all.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script type="text/javascript">
        var ue = UE.getEditor('container', {
            toolbars: [],
            isShow: true,
        });
        console.log(location.search)
        ue.ready(function() {
            var info = {
                id: location.search.substring(1).split(','),
                type: "PrintRecipt",
            }

            $.ajax({
                url: '../api/print/do',
                data: JSON.stringify(info),
                type: "POST",
                dataType: "json",
                contentType: "application/json",
                success: function(data) {
                    if (data.status == 200) {
                        ue.setContent(data.data);
                    }
                },
                error: function(ajaxobj) {}
            });
        })
        ue.addListener('afterSetContent', function(editor) {
            // setTimeout(function() {
            //     UE.getEditor('container').setHide()
            // }, 100)
            setTimeout(function() {
                ue.execCommand('print')
            }, 1000)

        })
    </script>
    <div id='container' style="height:auto;">
    </div>
</body>

</html>